<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>原型和原型链</h2>
</body>
<script>
    function Person(name = '无名') {
        this.name = name
    }

    Person.prototype.getUserInfo = function() {
        return `我的名称叫${this.name}`
    }

    const p1 = new Person('张三')
        // console.log(p1.__proto__ === Person.prototype)
        // console.log(Person.prototype.__proto__ === Object.prototype)
        //console.log(p1.__proto__.__proto__ === Object.prototype)
        // console.log(Object.prototype.__proto__ === null)

    console.log(p1.constructor === Person)
    console.log(Person.prototype.constructor === Person)


    // console.log(p1.name)
    // console.log(p1.getUserInfo())
</script>

</html>